<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MenuModel extends Model
{
    protected $table = 'menu';
    protected $guarded = [];
    public $timestamps = true;

    public function operation() {
        return $this->hasManyThrough(
            OperationModel::class,
            PermissionListModel::class,
            'operation_id',
            'id',
            'id',
            'menu_id'
        );
    }

    public function permissionList() {
        return $this->hasMany(PermissionListModel::class, 'menu_id', 'id');
    }
}